package com.app.signing

import org.junit.Assert.assertEquals
import org.junit.Test

/**
 * Example local unit test, which will execute on the development machine (host).
 *
 * See [testing documentation](http://d.android.com/tools/testing).
 */
class ExampleUnitTest {
    @Test
    fun addition_isCorrect() {
        assertEquals(4, 2 + 2)
        val time = 4003700
        println(formatTime(time))
    }

    private fun formatTime(totalTime: Int): String {
        var hour = 0
        var minute = 0
        var second: Int
        second = totalTime / 1000
        if (totalTime in 1..1000) {
            second = 1
        }
        if (second > 60) {
            minute = second / 60
            second %= 60
        }
        if (minute > 60) {
            hour = minute / 60
            minute %= 60
        }
        // 转换时分秒 00:00:00
        return (if (hour >= 10) hour.toString() else "0$hour").toString() + ":" + (if (minute >= 10) minute else "0$minute") + ":" + if (second >= 10) second else "0$second"
    }
}
